<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProposalsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('proposals', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->default(0)->comment('提意见的用户');
            $table->integer('answer_user_id')->default(0)->comment('反馈的管理员用户');
            $table->string('title')->nullable()->comment('意见标题');
            $table->text('message')->comment('建议内容');
            $table->text('images')->comment('图片 paths');
            $table->string('re_message')->default('')->comment('回复内容');
            $table->tinyInteger('score')->default(0)->comment('1-5 评分, 回复后才能打分');
            $table->string('remarks')->nullable()->comment('评分的备注');
            $table->integer('push_time');
            $table->timestamps();
            $table->softDeletes();
            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('proposals');
    }
}
